ReactiveProperty class¶
Attributes: [DataContract] [DebuggerDisplay("{IsDisposed}, {Value}")]
Defined in
Namespace: ReactiveUI.Reactive
Assembly: ReactiveUI.Reactive.dll
Full name: ReactiveUI.Reactive.ReactiveProperty<T>
Modifiers: public
Summary¶
Represents a reactive property that notifies subscribers of value changes and supports asynchronous validation and
error notification.
Applies to
net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471
Class hierarchy
classDiagram
class ReactiveProperty~T~
class ReactiveObject
ReactiveObject <|-- ReactiveProperty~T~
class IReactiveProperty~T~ {
<>
}
IReactiveProperty~T~ <|.. ReactiveProperty~T~
class IObservable~T?~ {
<>
}
IObservable~T?~ <|.. ReactiveProperty~T~
class IsDisposed {
<>
}
IsDisposed <|.. ReactiveProperty~T~
class IDisposable {
<>
}
IDisposable <|.. ReactiveProperty~T~
class INotifyDataErrorInfo {
<>
}
INotifyDataErrorInfo <|.. ReactiveProperty~T~
class INotifyPropertyChanged {
<>
}
INotifyPropertyChanged <|.. ReactiveProperty~T~
Inherits from: ReactiveObject
Implements: IReactivePropertyIsDisposed, IDisposable, INotifyDataErrorInfo, INotifyPropertyChanged
Remarks¶
ReactiveProperty provides observable value semantics, allowing consumers to subscribe to value changes and validation error updates. It supports INotifyPropertyChanged and INotifyDataErrorInfo for integration with data binding scenarios. Validation logic can be attached to perform asynchronous or synchronous checks, and error notifications are propagated to observers. Thread safety and scheduling of notifications are managed via the provided scheduler. Disposing the instance releases all resources and completes all observable streams.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [ReactiveProperty](# class with the default value, using the task pool scheduler and default notification and distinctness... |
Properties¶
| Name | Summary |
|---|---|
| IsDisposed | Gets a value indicating whether gets a value that indicates whether the object is disposed. |
| Value | Gets or sets the current value of the container. |
| HasErrors | Gets a value indicating whether any errors are currently present. |
| ObserveErrorChanged | Gets an observable sequence that signals when the collection of validation errors changes. |
| ObserveHasErrors | Gets an observable sequence that signals whether the object currently has validation errors. |
Methods¶
| Name | Summary |
|---|---|
| static Create | Creates a new instance of ReactiveProperty without requiring RequiresUnreferencedCode attributes. Uses RxSchedulers.TaskpoolScheduler as the default scheduler. |
| AddValidationError | Adds a validation rule to the current ReactiveProperty instance using the specified validator function. |
| Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| CheckValidation | Triggers the validation check for the current value. |
| Refresh | Refreshes the current value and notifies subscribers of any changes. |
| GetErrors | Gets the validation errors for the specified property or for the entire object. |
| Subscribe | Subscribes the specified observer to receive notifications from this observable sequence. |
Events¶
| Name | Summary |
|---|---|
| ErrorsChanged |
Inherited members
ReactiveUI.Reactive.ReactiveObject.SuppressChangeNotificationsReactiveUI.Reactive.ReactiveObject.AreChangeNotificationsEnabledReactiveUI.Reactive.ReactiveObject.DelayChangeNotificationsReactiveUI.Reactive.ReactiveObject.#ctorReactiveUI.Reactive.ReactiveObject.ChangingReactiveUI.Reactive.ReactiveObject.ChangedReactiveUI.Reactive.ReactiveObject.ThrownExceptionsReactiveUI.Reactive.ReactiveObject.PropertyChangingReactiveUI.Reactive.ReactiveObject.PropertyChangedSystem.Object.Equals(System.Object)System.Object.Equals(System.Object,System.Object)System.Object.GetHashCodeSystem.Object.GetTypeSystem.Object.MemberwiseCloneSystem.Object.ReferenceEquals(System.Object,System.Object)System.Object.ToString